#!/bin/bash

#kubectl的快捷键
echo "alias k='/usr/local/bin/kubectl'" >> ~/.bashrc
#namespace的快速切换，默认是default
sudo chmod 777 -R /home/vagrant/.kube/
echo "alias kcd='kubectl config set-context $(kubectl config current-context) --namespace'" >> ~/.bashrc
:<<EOF
快捷键操作例子
kcd kubesphere-system
k get svc
EOF

#kubectl的TAB补全
/usr/local/bin/kubectl completion bash |sudo tee /etc/bash_completion.d/kubectl.sh
# 别名的也补全
/usr/local/bin/kubectl completion bash |sed 's/kubectl/k/g'|sudo tee /etc/bash_completion.d/k.sh
